-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Julia bindings #1025
base: dev
Are you sure you want to change the base?
Julia bindings #1025
Conversation
CMakeLists.txt
Outdated
if(openPMD_HAVE_JlCxx) | ||
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION) | ||
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY) | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memo to myself: generalize.
- Control RPATH install (default: on) via option.
- Add
JlCxx_location
only toopenPMD_jl
target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prepared in #1105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is really cool. Wuhu! Let me ping potentially @williamfgc, @berceanu and @MaxThevenet as they are excited about Julia as well. Maybe one of you is interested to add a review? :) (Otherwise sorry for the noise, please don't hesitate to unsubscribe from the thread.) |
Regarding packaging:
I think the best path forward would be to release openPMD-api binaries on Yggdrasil, with the Julia bindings enabled, and to use it from the openPMD.jl Julia package. I'm working on this at the moment. Regarding examples and tests: Tests are there in the Julia package. Examples are completely missing. Regarding docs: Simple docs are there (the API is documented). There is no introduction or overview. The general approach of how the C++ functions are mapped to Julia functions is also not yet described. Regarding CI: The Julia package will have CI, once it's set up properly. |
@ax3l @eschnett thanks for the great work here. I'll probably be mostly learning since @eschnett did all the things I was planning to use in another project. Just a few things to think about that are collaterals:
@eschnett for the C++-object to Julia-type wrapper are you just translatin |
@williamfgc Performance isn't good yet. At the moment, I'm copying data in some places where I really should pass references. This is just because I'm fighting other battles at the moment. I've marked most of the places where performance is bad with Yes.
I want the code to look "natural" in Julia. |
I have pushed three commits:
|
7379a6d
to
39cb4cf
Compare
I hadn't noticed that you added the minimal lowlevel example, too. I've merged them both now, they now run from within I will expand the test a little and have a more in-depth look at your changes next week. |
39cb4cf
to
c6fe874
Compare
c6fe874
to
d548c90
Compare
|
||
# We need Julia 1.7 or newer | ||
using("Pkg") | ||
Pkg.add("openPMD") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only remaining question before merging this PR is how we should go about documentation?
I feel like we should mark this as experimental until we also have the high-level bindings merged?
Should we add documentation apart from install.rst, too? I think that we can keep it short due to the experimental status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds fine. I would point to openPMD.jl
as an existing package that uses these bindings, so that people are not put off by the experimental status – it's not openPMD that is experimental, it's only the way things are currently glued together.
…penPMD-api into eschnett/julia-bindings
* dev: Fix CMake: HDF5 Libs are PUBLIC (openPMD#1520) Fix `chmod` in `download_samples.sh` (openPMD#1518) CI: Old CTest (openPMD#1519) Python: Fix ODR Violation (openPMD#1521) replace extent in weighting and displacement (openPMD#1510) CMake: Warn and Continue on Empty HDF5_VERSION (openPMD#1512) Replace openPMD_Datatypes global with function (openPMD#1509) Streaming examples: Set WAN as default transport (openPMD#1511) TOML Backend (openPMD#1436) make it possible to manually set chunks when loading dask arrays (openPMD#1477) [pre-commit.ci] pre-commit autoupdate (openPMD#1504) Optional debugging output for AbstractIOHandlerImpl::flush() (openPMD#1495) Python: 3.8+ (openPMD#1502) # Conflicts: # .github/workflows/linux.yml # src/binding/python/Series.cpp
* dev: [pre-commit.ci] pre-commit autoupdate (openPMD#1536) Fix double mesh.read() call (openPMD#1535) Python 3.12: Remove Distutils (openPMD#1508) openpmd-pipe: fix handling of constant components (openPMD#1530) Bug fix: Linear read mode cannot directly access specific file of file-based Series (openPMD#1533) Unknown openPMD version in data: Add upgrade hint (openPMD#1528)
I have grown quite dissatisfied with At the same time, the bindings produced by this library are not directly usable from Julia. The API it creates does not look "natural" for Julia, and requires another wrapper (written in Julia) to make it usable. Thus #1537. This creates C bindings for openPMD, and wrapping them from Julia will be about the same amount of work as using |
This adds bindings for the Julia language to openPMD. These bindings are still a work in progress; they are incomplete and/or inefficient.
Julia bindings consist of two parts:
Since Julia is a different language, one probably should not wrap all features one-to-one. For example, types are first class objects in Julia, so that much of the
Datatype
class is not necessary. Also, Julia is not object-oriented, and thus all function are free functions (and not member functions), etc.I'm posting this here in case someone wants to add a comment.
Related to #625
To Do